package com.wantupai.mvp.framework.lce.impl.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;

import com.wantupai.mvp.framework.lce.MvpLceView;
import com.wantupai.mvp.framework.lce.impl.animator.DefaultLceAnimator;
import com.wantupai.mvp.mvp.MvpPresenter;


/**
 * @param <M>
 * @param <V>
 * @param <P>
 * @author zhangqing
 */
public abstract class BaseMvpLceActivity<M, V extends MvpLceView<M>, P extends MvpPresenter<V>> extends MvpLceActivity<M, V, P>
{


    protected boolean isInit = false;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(getContentView());
        ViewGroup mViewGroup = (ViewGroup) findViewById(android.R.id.content);
        initNavigation((ViewGroup) mViewGroup.getChildAt(0));
        initContentView(getWindow().getDecorView().getRootView());
    }


    @Override
    protected void onResume()
    {
        super.onResume();
        if (!isInit)
        {
            isInit = true;
            setLceAnimator(new DefaultLceAnimator());
            initData();
        }
    }

    public void initData()
    {
        loadData(false);
    }

    public abstract int getContentView();

    public void initContentView(View view)
    {

    }

    public void initNavigation(ViewGroup contentView)
    {
    }

}
